#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1e6 + 5;

int n, m;
int np[N];
int primes[N], tot;
int mnp[N];
int cnt[N];
int p[N];
void init(int n) {
  np[1] = 1;
  mnp[1] = 1;
  rep(i, 2, n) {
    if (!np[i]) {
      primes[++tot] = i;
      mnp[i] = i;
    }
    rep(j, 1, tot) {
      ll k = 1ll * primes[j] * i;
      if (k > n) break;
      np[k] = 1;
      mnp[k] = primes[j];
      if (i % primes[j] == 0) break;
    }
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  init(n);
  rep(i, 1, n) cnt[i] = 1;
  per(i, n, 2) {
    int x = i / mnp[i];
    cnt[x] += cnt[i];
    p[mnp[i]] += cnt[i];
  }
  rep(i, 2, n) {
    if (p[i]) cout << i << ' ' << p[i] << endl;
  }
  return 0;
}